<template>
  <div>
    <el-tooltip content="发送邮箱">
      <el-button
        class="button"
        v-loading="loading"
        @click="handleClick"
        :disabled="isDisable"
      >
        <div class="svg-wrapper-1">
          <div class="svg-wrapper">
            <svg
              height="24"
              width="24"
              viewBox="0 0 24 24"
              xmlns="http://www.w3.org/2000/svg"
            >
              <path d="M0 0h24v24H0z" fill="none"></path>
              <path
                d="M1.946 9.315c-.522-.174-.527-.455.01-.634l19.087-6.362c.529-.176.832.12.684.638l-5.454 19.086c-.15.529-.455.547-.679.045L12 14l6-8-8 6-8.054-2.685z"
                fill="currentColor"
              ></path>
            </svg>
            <slot class="content" name="content">发送></slot>
          </div>
        </div>
      </el-button>
    </el-tooltip>
  </div>
</template>

<script>
export default {
  props: {
    isDisabled: {
      type: Boolean,
      required: false,
      default: false
    },
    Loading: {
      type: Boolean,
      default: false
    }
  },
  components: {},
  data() {
    return {
      isDisable: false,
      loading: false
    }
  },
  computed: {},
  watch: {
    isDisabled: {
      immediate: true,
      handler(val) {
        this.isDisable = val
      }
    },
    Loading: {
      immediate: true,
      handler(val) {
        this.loading = val
      }
    }
  },
  created() {},
  mounted() {},
  methods: {
    handleClick() {
      this.$emit('custom-click')
    }
  }
}
</script>

<style scoped>
.button {
  font-family: inherit;
  font-size: 14px;
  background: royalblue;
  color: white;
  height: 0.8rem;
  min-width: 0.9rem;
  text-align: center;
  padding: 0.7em 1em;
  border-radius: 16px;
  padding-left: 0.9em;
  display: flex;
  align-items: center;
  border: none;
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.2s;
}

.button span {
  display: block;
  margin-left: 0.3em;
  transition: all 0.3s ease-in-out;
}
.button .content {
  width: 100%;
  text-align: center;
}
.button svg {
  display: block;
  transform-origin: center center;
  transition: transform 0.3s ease-in-out;
}

.button:hover .svg-wrapper {
  animation: fly-1 0.6s ease-in-out infinite alternate;
}

.button:hover svg {
  transform: translateX(1.2em) rotate(45deg) scale(1.1);
}

.button:hover span {
  transform: translateX(5em);
}

.button:active {
  transform: scale(0.95);
}

@keyframes fly-1 {
  from {
    transform: translateY(0.1em);
  }

  to {
    transform: translateY(-0.1em);
  }
}
</style>
